<?php
if ( !defined('IN_ADMINCP') || !defined('IN_SEC') ){
	exit('Access Denied.');
}

$call = conf('call-center');

$query_string = array();
$uri = $_SERVER['REQUEST_URI'];
$query = strpos($uri, '?');

if ( $query ){
	$uri = substr($uri, $query + 1);
	parse_str($uri, $query_string);
}


$totalsearch = htmlspecialchars($_G['gp_totalsearch']);

$adminid = &$admincp->adminid;

#==========Search
$where = array('sale_id' => $adminid);
$sea_high = $_G['gp_sea_high'];

$sea_name = htmlspecialchars($_G['gp_name']);
$sea_contact_phone = htmlspecialchars($_G['gp_contact_phone']);

$sea_adminid = $_G['gp_sea_adminid'] > 0 ? intval($_G['gp_sea_adminid']) : 0;

if( $sea_name ){
	$where[] = "`realname` LIKE '%".DB::EscapeString($sea_name)."%'";
}

if( $sea_contact_phone ){
	$where[] = "`mobile` LIKE '%".DB::EscapeString($sea_contact_phone)."%'";
}

#Search==========
$count = DB::Count('admincp_member', $where);
$pages = pages($count, $pagesize ? $pagesize : 20);
$options = array('order' => 'ORDER BY `create_time` DESC, `id` DESC');
$customers = limitquery('admincp_member', $where, $options, $pages['offset'], $pages['pagesize']);

?>